{% extends "base.html" %}
{% block title %}学生列表页{% endblock %}
{% block styles %}
    {{ super() }}
    <style>
        .table>tbody>tr>td {
            text-align: center;
        }
        .table thead>tr>th {
            text-align: center;
        }
        .table thead {
            background: #ebeaea;
        }
    </style>
{% endblock %}
{% block page_content %}
    {{ super() }}
    <form action="{{ url_for('student_list') }}" method="post">
        <div class="form-group">
            {% for msg in form.name.errors %}<small class="errors">{{ msg }}</small><br>{% endfor %}
            {{ form.name() }}
            {{ form.submit() }}
        </div>
    </form>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>姓名</th>
            <th>性别</th>
            <th>班级</th>
            <th style="width: 150px;">操作</th>
        </tr>
        </thead>
        <tbody>
        {% for student in students %}
        <tr>
            <td>{{ student.name }}</td>
            <td>{{ student.gender }}</td>
            <td>{{ student.class_name }}</td>
            <td>
                <a href="{{ url_for('student_detail', idx=student.id) }}">详情</a>
                <a href="{{ url_for('student_update', idx=student.id) }}">修改</a>
                <a href="{{ url_for('student_delete', idx=student.id) }}">删除</a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>


{% endblock %}
